/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trabalhoGA;

import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author Douglas
 */
public class Util {

    /**
     * Retorna a próxima linha do InputStream, concantenada em String.
     *
     * @param in
     * @return
     * @throws IOException
     */
    public static String nextLine(InputStream in) throws IOException {

        StringBuilder s = new StringBuilder();
        int read = 0;
        char caracter;
        while ((read = in.read()) != -1) {
            caracter = (char) read;
            // Se chegou ao fim da linha
            if (caracter == '\n') {
                break;
            }

            s.append(caracter);
        }
        // String concatenada
        return s.toString();
    }
}